<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //双重for循环打印多行星星
        var str = '';
        var w_num = prompt('横排想要几个');
        var h_num = prompt('竖排想要几个');
        for (var i = 1; i <= w_num; i++) {
            //str = str + '*';
            for (var j = 1; j <= h_num; j++) {
                str = str + '*';



            } str = str + '\n';

        }
        console.log(str);

        // by sjs 注意代码格式
    </script>
</head>

<body>

</body>

</html>